package com.example.case02_recyclerview229;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
private RecyclerView recyclerView;
private List<Food_bhm229> list;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        recyclerView=findViewById(R.id.recyclerView);
        RecyclerView.LayoutManager layoutManager=new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setHasFixedSize(true);
        list=getData();
        Adapter adapter=new Adapter(this,list);
        recyclerView.setAdapter(adapter);
    }
    private  List<Food_bhm229> getData(){
        List<Food_bhm229> list=new ArrayList<>();
        Food_bhm229 demobean=new Food_bhm229();
        demobean.setId(1);
        demobean.setTitle("糖醋小排");
        demobean.setDes("酸甜适中");
        demobean.setShopname("店名：东软二期A1");
        demobean.setPrice("价格：15元");
        demobean.setTime("2021-10-20");
        demobean.setTel("电话：12345678987");
        demobean.setPl("肋排500克，香葱1棵，生姜1块，大蒜2瓣，" +
                "淀粉适量，食用油500克（实耗45克），酱油1/2大匙，香醋1大匙，精盐1/2小匙，" +
                "白糖（黄糖）1大匙，味精1/2小匙。");
        demobean.setImages(R.drawable.food1);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(2);
        demobean.setTitle("烧白");
        demobean.setDes("咸中略带甜味");
        demobean.setShopname("东软二期A2");
        demobean.setPrice("14元");
        demobean.setTime("2021-10-20");
        demobean.setTel("电话：12345676687");
        demobean.setImages(R.drawable.food2);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(3);
        demobean.setTitle("排骨");
        demobean.setDes("咸香味美");
        demobean.setShopname("东软二期A3");
        demobean.setPrice("18元");
        demobean.setTime("2021-10-20");
        demobean.setTel("电话：12385678987");
        demobean.setImages(R.drawable.food3);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(4);
        demobean.setTitle("剁椒鱼");
        demobean.setDes("香辣");
        demobean.setShopname("东软三期A1");
        demobean.setPrice("25元");
        demobean.setTime("2021-10-20");
        demobean.setTel("12845678987");
        demobean.setImages(R.drawable.food4);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(5);
        demobean.setTitle("素炒青菜");
        demobean.setDes("清爽可口");
        demobean.setShopname("东软三期A2");
        demobean.setPrice("9元");
        demobean.setTime("2021-10-20");
        demobean.setTel("12345998987");
        demobean.setImages(R.drawable.food5);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(6);
        demobean.setTitle("炒土豆丝");
        demobean.setDes("咸鲜酸辣");
        demobean.setShopname("东软三期A3");
        demobean.setTime("2021-10-20");
        demobean.setPrice("8元");
        demobean.setTel("12345676587");
        demobean.setImages(R.drawable.food6);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(7);
        demobean.setTitle("饺子");
        demobean.setDes("好吃");
        demobean.setShopname("东软教职工食堂1");
        demobean.setPrice("15元");
        demobean.setTime("2021-10-20");
        demobean.setTel("12366678987");
        demobean.setImages(R.drawable.food13);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(7);
        demobean.setTitle("刀削面");
        demobean.setDes("筋道美味");
        demobean.setShopname("东软教职工食堂2");
        demobean.setPrice("12元");
        demobean.setTime("2021-10-20");
        demobean.setTel("12389567897");
        demobean.setImages(R.drawable.food12);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(6);
        demobean.setTitle("水煮肉片");
        demobean.setDes("香，辣");
        demobean.setShopname("东软教职工食堂1");
        demobean.setPrice("17元");
        demobean.setTime("2021-10-20");
        demobean.setTel("17745678987");
        demobean.setImages(R.drawable.food7);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(7);
        demobean.setTitle("炒芹菜");
        demobean.setDes("缓解高血压");
        demobean.setShopname("东软教职工食堂1");
        demobean.setPrice("15元");
        demobean.setTime("2021-10-20");
        demobean.setTel("12333678987");
        demobean.setImages(R.drawable.food8);
        list.add(demobean);

        demobean=new Food_bhm229();
        demobean.setId(7);
        demobean.setTitle("素炒菜");
        demobean.setDes("好吃");
        demobean.setShopname("东软教职工食堂2");
        demobean.setPrice("11元");
        demobean.setTime("2021-10-20");
        demobean.setTel("12575678987");
        demobean.setImages(R.drawable.food9);
        list.add(demobean);
        return list;
    }
}
